From: Florian Müllner Date: Fri, 9 Jun 2023 18:12:15 +0000 (+0200) Subject: animations: Stop syncing size manually X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~337^2~2^2~3 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=097c21d14045dfd433d13f85a8843580db38ed84;p=gnome-shell.git animations: Stop syncing size manually The returned slice actors are now set up to fill their parent, accounting for any difference between loaded- and displayed size, so we can stop syncing the size manually. Part-of: --- diff --git a/js/ui/animation.js b/js/ui/animation.js index 0a784413a..b70f8767b 100644 --- a/js/ui/animation.js +++ b/js/ui/animation.js @@ -40,10 +40,6 @@ class Animation extends St.Bin { this._frame = 0; this._loadFile(file, width, height); - - // If the parent changes, we need to re-sync the animation - // size - this.connect('parent-set', () => this._syncAnimationSize()); } play() { @@ -81,11 +77,12 @@ class Animation extends St.Bin { let scaleFactor = St.ThemeContext.get_for_stage(global.stage).scale_factor; this._animations = textureCache.load_sliced_image(file, width, height, scaleFactor, resourceScale, - () => this._syncAnimationSize()); + () => this._loadFinished()); this._animations.set({ x_align: Clutter.ActorAlign.CENTER, y_align: Clutter.ActorAlign.CENTER, }); + this.set_child(this._animations); if (wasPlaying) @@ -109,19 +106,10 @@ class Animation extends St.Bin { return GLib.SOURCE_CONTINUE; } - _syncAnimationSize() { + _loadFinished() { this._isLoaded = this._animations.get_n_children() > 0; - // this.get_size() can't be called without a parent - if (!this._isLoaded || !this.get_parent()) - return; - - let [width, height] = this.get_size(); - - for (let i = 0; i < this._animations.get_n_children(); ++i) - this._animations.get_child_at_index(i).set_size(width, height); - - if (this._isPlaying) + if (this._isLoaded && this._isPlaying) this.play(); }